/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sokobantest;

import java.awt.Graphics;
import java.awt.Image;

/**
 *
 * @author bram
 */
public class GameObject {
    
    private int positionX;
    private int positionY;
    private Image image;
    
    public GameObject(){
        
    }

    public Image[][] defineWorld(String level){
        Image[][] result = new Image[11][20];
        int row = 0;
        int column = 0;
        for(int i = 0; i < level.length(); i++){
            char dit = level.charAt(i);
            if(column == 20){ System.out.println("---echt te veeel of nieuwe row column : " + column + " en row " + row + " char :" + dit); }
            switch(dit){
                case '\n':
                    
                    System.out.println("nu breekt het");
                    row += 1;
                    column = 0;
                break;
                    
                case '#': 
                    System.out.println("u bevind zich op column : " + column + " en row " + row);
                    Wall tmpWall = new Wall();
                    result[row][column] = tmpWall.getImage();
                break;
                    
                case ' ': 
                    result[row][column] = null;
                    System.out.println("u bevind zich op column : " + column + " en row " + row);
                break;
                    
                case '.': 
                    result[row][column] = null;
                    System.out.println("u bevind zich op column : " + column + " en row " + row);
                break;
                    
                case '@': 
                    System.out.println("u bevind zich op column : " + column + " en row " + row);
                    Player tmpPlayer = new Player();
                    result[row][column] = tmpPlayer.getImage();
                break;
                    
                case '$': 
                    System.out.println("u bevind zich op column : " + column + " en row " + row);
                    Crate tmpCrate = new Crate();
                    result[row][column] = tmpCrate.getImage();
                break;
                    
                case '*': 
                    result[row][column] = null;
                    System.out.println("u bevind zich op column : " + column + " en row " + row);
                break;
                    
                case '+': 
                    System.out.println("u bevind zich op column : " + column + " en row " + row );
                break;
                   
                default:
                    result[row][column] = null;
                break;
            }
            
            if(dit == '\n'){
                
            }else if(column < 20){
                column += 1;
                
            }else{
                System.out.println("echt te veeel of nieuwe row column : " + column + " en row " + row);
            }
           
        }
        
        return result;
    }
    public int getPositionX() {
        return positionX;
    }

    public int getPositionY() {
        return positionY;
    }

    public Image getImage() {
        return image;
    }
    
    public Image returnGrapic(GameObject dit){
        Image result = dit.getImage();
        return result;
    }

    public void setPositionX(int positionX) {
        this.positionX = positionX;
    }

    public void setPositionY(int positionY) {
        this.positionY = positionY;
    }

    public void setImage(Image image) {
        this.image = image;
    }
    
}
